<?php 
/* 
Proyecto: Sistema Victoria 2.0
Programador: Felipe Guerra
Año: 2015
Flores de tumbabiro ©
*/
require_once('../core/libreria.php');
require_once('../db/connect.php'); 

$filaMostrar = $_GET['id'];
$cp = $_GET['cp'];
$pn = $_GET['pn'];

if($_POST['verify'] and $_POST['verify'] == 'verify'){

	$sql = sprintf("
	DELETE
	FROM cliente
	WHERE CLI_CODIGO = %s
	",
	GetSQLValueString($_GET['id'], "CLI_CODIGO"));
	mysql_select_db($database_victoria, $victoria );
	mysql_query($sql, $victoria ) or die(mysql_error());

	$fileNom = $_GET['pn'].'List.php';
	if (isset($_SERVER['QUERY_STRING'])) {
		$fileNom .= (strpos($fileNom, '?')) ? "&" : "?";
		$fileNom .= $_SERVER['QUERY_STRING'];
	}
	header(sprintf("Location: %s", $fileNom));

}

//--------------------SELECT INICIO---------------------
mysql_select_db($database_victoria, $victoria );
$query_rsListar = "
SELECT
*
FROM cliente
WHERE CLI_CODIGO = '$filaMostrar'
";
//--------------------SELECT FIN------------------------

$rsListar = mysql_query($query_rsListar, $victoria ) or die(mysql_error());
$row = mysql_fetch_assoc($rsListar);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../css/list.css" /><!--Importante, siempre debe ir antes del css del menu vertical-->
<link href="../css/dcverticalmegamenu.css" rel="stylesheet" type="text/css" /><!--	Menu vertical	-->
<script src="../js/jquery.js"></script>
<link rel="stylesheet" href="../css/jquery-ui.css" />
<script src="../js/jquery-ui.js"></script>
</head>
<body id="bodyIndex" >

<form action="" method="post" name="form" id="form" >
    
<!--Estilos de la tabla utilizada para ver y ABC-->
<link rel="stylesheet" href="../css/tabla.css" />

<!--Javascript de la tabla utilizada para ABC-->
<script src="../js/tabla.js"></script>



<table align="center" width="90%" border="1" style="background-color:#FFFFFF" class="tabla_css" >
  <tr  id="tr_encabezado" >
    <td colspan="2" id="td_encabezado">
        Ver registro	
    </td>
  </tr>  
  <tr>
    <td colspan="2" style="padding:0px;" >  
        <!------------------------------------------------------------------------------------------------------INICIO: Cliente-->        
        <table align="center" width="100%" border="0" style="background-color:#FFFFFF; margin-bottom: 0px;" class="tabla_css" >        
          <tr>
            <td class="etiqueta" ><strong>Nombre cliente: </strong></td>
            <td class="etiqueta" ><?php echo $row['CLI_NOMBRE_EMP'];?></td>
            <td class="etiqueta" ><strong>Pais: </strong></td>
            <?php 
            //┌────────────────────────────────┐
            mysql_select_db($database_victoria, $victoria );
            $sql = 
        "
        SELECT
          PAI_CODIGO,
          PAI_NOMBRE
        FROM pais
        WHERE PAI_VIGENCIA = 1
        AND PAI_PAI_CODIGO = 1
        AND PAI_CODIGO = ".$row['PAI_CODIGO']."
        ORDER BY PAI_NOMBRE
        ";
            $tabla = mysql_query($sql, $victoria ) or die(mysql_error());
            $fila = mysql_fetch_assoc($tabla);
            //└────────────────────────────────┘
            ?>
            <td width="20%"><?php echo $fila['PAI_NOMBRE'];?></td>
          </tr>
          <tr>
            <td class="etiqueta" ><strong>Tipo cliente: </strong></td>
            <?php 
            //┌────────────────────────────────┐
            mysql_select_db($database_victoria, $victoria );
            $sql = 
        "
        SELECT
          TIP_CODIGO,
          TIP_DESCRIPCION
        FROM tipo_cliente
        WHERE TIP_VIGENCIA = 1
        AND TIP_CODIGO = ".$row['TIO_CODIGO']."
        ORDER BY TIP_DESCRIPCION";
            $tabla = mysql_query($sql, $victoria ) or die(mysql_error());
            $fila = mysql_fetch_assoc($tabla);
            //└────────────────────────────────┘
            ?>
            <td width="20%"><?php echo $fila['TIP_DESCRIPCION'];?></td>
            <td colspan="2" class="etiqueta" ><strong>Persona &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Natural: </strong>      <input disabled="disabled" type="radio" <?php echo ($row['CLI_PERSONA_NAT'] == 1 ? 'checked="checked"' : '' );?> />
              &nbsp;&nbsp;<strong>Jurídica:</strong>
        <input disabled="disabled" type="radio" <?php echo ($row['CLI_PERSONA_NAT'] == 1 ? 'checked="checked"' : '' );?> />
        &nbsp;&nbsp;<strong> Extrangera:</strong>
        <input disabled="disabled" type="radio" <?php echo ($row['CLI_PERSONA_NAT'] == 1 ? 'checked="checked"' : '' );?> /></td>
          </tr>
          <tr>
            <td class="etiqueta" ><strong>Contribuyente especial: </strong></td>
            <td class="etiqueta" ><strong>Si:
              </strong>
              <input disabled="disabled" type="radio" <?php echo ($row['CLI_CESPECIAL'] == 1 ? 'checked="checked"' : '' );?> />
              &nbsp;&nbsp;<strong>No:
            </strong>      <input disabled="disabled" type="radio" <?php echo ($row['CLI_CESPECIAL'] == 1 ? 'checked="checked"' : '' );?> /></td>
            <td width="20%" class="etiqueta" ><strong>Tipo documento: </strong></td>
            <?php 
            //┌────────────────────────────────┐
            mysql_select_db($database_victoria, $victoria );
            $sql = 
        "
        SELECT
          TIP_CODIGO,
          TIP_NOMBRE
        FROM tipo_documento
        WHERE TIP_VIGENCIA = 1
        AND TIP_CODIGO = ".$row['TIP_CODIGO']."
        ORDER BY TIP_NOMBRE";
            $tabla = mysql_query($sql, $victoria ) or die(mysql_error());
            $fila = mysql_fetch_assoc($tabla);
            //└────────────────────────────────┘
            ?>
            <td width="20%"><?php echo $fila['TIP_NOMBRE'];?></td>
          </tr>  
          <tr>
            <td width="20%" class="etiqueta" ><strong>Ruc: </strong></td>
            <td width="20%" class="etiqueta" ><?php echo $row['CLI_RUC_EMPRESA'];?></td>
            <td width="20%" class="etiqueta" ><strong>Categoría tercero: </strong></td>
            <?php 
            //┌────────────────────────────────┐
            mysql_select_db($database_victoria, $victoria );
            $sql = 
        "
        SELECT
          CTE_CODIGO,
          CTE_NOMBRE
        FROM categoria_tercero
        WHERE CTE_VIGENCIA = 1
        AND CTE_CODIGO = ".$row['CTE_CODIGO']."
        ORDER BY CTE_NOMBRE";
            $tabla = mysql_query($sql, $victoria ) or die(mysql_error());
            $fila = mysql_fetch_assoc($tabla);
            //└────────────────────────────────┘
            ?>
            <td width="20%"><?php echo $fila['CTE_NOMBRE'];?></td>
          </tr>  
          <tr>
            <td class="etiqueta" ><strong>Nombre comercial: </strong></td>
            <td class="etiqueta" ><?php echo $row['CLI_NOM_COMERC'];?></td>
            <td class="etiqueta" ><strong>Abreviatura: </strong></td>
            <td><?php echo $row['CLI_ABREVIATURA'];?></td>
          </tr>
          <tr>
            <td colspan="2" class="etiqueta" ><strong>Cliente &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nacional: 
              <input disabled="disabled" type="radio" <?php echo ($row['CLI_NACIONAL'] == 1 ? 'checked="checked"' : '' );?> />
              &nbsp;&nbsp;Extrangero:
              <input disabled="disabled" type="radio" <?php echo ($row['CLI_NACIONAL'] == 1 ? 'checked="checked"' : '' );?> />
              &nbsp;&nbsp;Nacional y extrangero:
              <input disabled="disabled" type="radio" <?php echo ($row['CLI_NACIONAL'] == 1 ? 'checked="checked"' : '' );?> />
            </strong></td>
            <td class="etiqueta" ><strong>Representante: </strong></td>
            <td><?php echo $row['CLI_REPRESENTANTE'];?></td>
          </tr>
          <tr>
            <td width="20%" class="etiqueta" ><strong>Teléfono fijo: </strong></td>
            <td width="20%" class="etiqueta" ><?php echo $row['CLI_TELEFONO_FIJO'];?></td>
            <td width="20%" class="etiqueta" ><strong>Teléfono movil: </strong></td>
            <?php 
            //┌────────────────────────────────┐
            mysql_select_db($database_victoria, $victoria );
            $sql = 
        "
        SELECT
          TIP_CODIGO,
          TIP_DESCRIPCION
        FROM tipo_cliente
        WHERE TIP_VIGENCIA = 1
        AND TIP_CODIGO = ".$row['TIO_CODIGO']."
        ORDER BY TIP_DESCRIPCION";
            $tabla = mysql_query($sql, $victoria ) or die(mysql_error());
            $fila = mysql_fetch_assoc($tabla);
            //└────────────────────────────────┘
            ?>
            <td width="20%"><?php echo $row['CLI_TELEFONO_MOVIL'];?></td>
          </tr>  
          <tr>
            <td width="20%" class="etiqueta" ><strong>Dirección: </strong></td>
            <td width="20%" class="etiqueta" ><?php echo $row['CLI_DIRECCION'];?></td>
            <td width="20%" class="etiqueta" ><strong>Fax: </strong></td>
            <td width="20%"><?php echo $row['CLI_FAX_EMPRESA'];?></td>
          </tr>
          <tr>
            <td width="20%" class="etiqueta" ><strong>Correo: </strong></td>
            <td width="20%" class="etiqueta" ><?php echo $row['CLI_CORREO'];?></td>
            <td width="20%" class="etiqueta" ><strong>Skype: </strong></td>
            <td width="20%"><?php echo $row['CLI_SKYPE'];?></td>
          </tr>
          <tr>
            <td width="20%" class="etiqueta" ><strong>Correo estado cuenta: </strong></td>
            <td width="20%" class="etiqueta" ><?php echo $row['CLI_CORREO_ECUENTA'];?></td>
            <td width="20%" class="etiqueta" ><strong>Clave contacto: </strong></td>
            <td width="20%"><?php echo $row['CLI_CLAVE_CONTACTO'];?></td>
          </tr>
          <tr>
            <td width="20%" class="etiqueta" ><strong>Fecha de corte: </strong></td>
            <td width="20%" class="etiqueta" ><?php echo $row['CLI_FECHA_CORTE'];?></td>
            <td width="20%" class="etiqueta" >&nbsp;</td>
            <td width="20%">&nbsp;</td>
          </tr>
        </table>
        <!------------------------------------------------------------------------------------------------------FIN: Cliente-->        
    </td>
  </tr>      

  <tr>
    <td colspan="2" id="td_pie">
      <input id="" type="button" value="Eliminar"  class="btn btn-large"  onclick="$('#form').submit()"/>    
      <a href="<?php echo $_GET['pn']?>List.php?<?php echo 'cp='.$cp?>" class="btn btn-large" >
        Regresar
        </a>
        <div class="recargarBoton" ><img src="../imagenes/listABC/load.png" /></div>
      </td>
  </tr>  
</table>

<input id="verify" name="verify" type="hidden" value="verify"></input>

<form>


</body>
</html>